#! /usr/bin/env python3

def read_file_1(file_name: str='') -> None:
    """读取整个文件的内容"""
    with open(file_name, 'r', encoding='utf-8') as f:
        content = f.read()
        print(content)


def read_file_2(file_name: str='') -> None:
    """读取文件内容，并使用循环遍历"""
    with open(file_name, 'r', encoding='utf-8') as f:
        for row in f:
            # 删除每行数据后的换行符
            print(row.rstrip())


def read_file_3(file_name: str='') -> None:
    """读取所有内容并存至列表"""
    with open(file_name, 'r', encoding='utf-8') as f:
        # 返回列表对象
        content = f.readlines()
        # 遍历列表对象
    for row in content:
        # 删除每行数据后的换行符
        print(row.rstrip())


if __name__ == "__main__":
    file_name = 'note.txt'
    fun_list = [read_file_1, read_file_2, read_file_3]
    for fun in fun_list:
        print(fun.__doc__)
        fun(file_name)
        print()
